package com.yjz.designpattern.访问者模式;

// 具体访问者：重量访问者
class WeightVisitor implements Visitor {
    @Override
    public void visit(Book book) {
        System.out.println("Book weight: " + book.getWeight() + " kg");
    }

    @Override
    public void visit(Fruit fruit) {
        System.out.println("Fruit weight: " + fruit.getWeight() + " kg");
    }
}